<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function init (i) {
      if (i == 100) {
        return i;
      }
      return i + init(++i)
    }
    var s = init(1);
    console.log(s);

    // var sum = 0
    // for (var i = 1; i <= 100; i++) {
    //   sum += i;
    // }
    // console.log(sum);

    function jc (n) {
      if (n == 1) {
        return 1;
      }
      return n * jc(n - 1)
    }
    var k = jc(5)
    console.log(k);
  </script>
</body>

</html>